void main() {
  Person p = new Person(name: 'sss');
  Person p1 = Person(age: 66);
  p.say();
  p1.say();
  Person p2 = Person.of(name: '5555');
  p2.say();
}

class Person {
  String? name;
  int? age;
  String? sex;

  // 构造函数 两种写法 简写  一种完整写法
  // 构造函数名称和类名一样
  // Person(String? name, int? age, String? sex) {
  //   this.age = age;
  //   this.name = name;
  //   this.sex = sex;
  // }
  // 简写的写法
  Person({this.name, this.age, this.sex});
  // 别名写法
  Person.of({this.name, this.age, this.sex});
  say() {
    print('我是$name,今年$age,我是$sex');
  }
}
